/**
 * Created by WT-SUN on 2017/4/6.
 */
$(function () {
    queryComboData();

});
function queryComboData() {
    var code=CONSTANT.DictionaryTypeDefConstants.OHE_SERVICE_TYPE;
    $.ajax({
        type: 'post',
        url: ROOT_PATH + '/permission/dictionary/queryDictionaryByDictionaryTypeCode.shtml',
        data: {code: code},
        dataType: "json",
        success: function (result) {
            $('#serviceType').combobox({
                data: result,
                prompt:'请选择',
                valueField: 'id',
                textField: 'text',
                editable: false,
                panelHeight: '200',
                onLoadSuccess: function () {
                    $('#serviceType').combobox('setValue', serviceType);
                },
                onSelect: function (record) {

                }
            });
            //result = $.parseJSON(result);
        }
    });
}
/**
 * 提交表单
 */
function submitForm() {
    $('#orgEditForm').form('submit', {
        url: ROOT_PATH + '/occupationalHealth/hseServiceOrg/updateByIdSelective.shtml',
        onSubmit: function (param) {
            if (!$(this).form('validate')) {
                layer.alert('请正确填写信息', {icon: 5});
            }
            return $(this).form('validate');
        },
        success: function (result) {
            result = $.parseJSON(result);
            if (result.success) {
                layer.msg('保存成功', {
                    icon: 1,
                    time: 1000 //2秒关闭（如果不配置，默认是3秒）
                }, function () {
                    var indexp = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(indexp); //再执行关闭
                    window.parent.reLoadData();
                });
                
            }
            else {
                layer.msg('保存失败', {
                    icon: 2,
                    time: 1000
                });
            }
        }
    });
}